1. Technical Field
The disclosure relates in general to a method for generating a dynamic decoding lookup table and a portable electronic device applying the same.
2. Background
Along with advance in video multimedia technology and communication technology, new multimedia communication applications are continuously provided. In general, multimedia communication is used in the transmission and storage of large information, and involves data compression technology. The data compression technology includes a data lossless compression and a data loss compression. The variable length coding (VLC) algorithm is common. According the VLC algorithm, the symbol with low possibility is encoded into long bits, and symbols with high possibility is encoded into short bit, so that data is compressed during data encoding. In recent years, the VLC algorithm has been widely used in various video encoding/decoding protocols.
Since the encoding protocols are complicated, and most embedded systems use low-level processors, the mobile device is normally equipped with a multimedia hardware accelerator for implementing various encoding/decoding protocols or is even equipped with an application-specific integrated circuit (ASIC) capable of encoding/decoding data. Thus, many variable length encoding/decoding algorithms and their hardware frameworks are developed. As for an ASIC, the memory is important and occupies circuit area and circuit cost.
As the embedded processor technology is getting more and more matured, various encoding/decoding protocols may achieve real-time processing by software, and there is no need for the dedicated ASIC to implement the encoding/decoding protocols. The system on chip (SoC) is programmable and accordingly is useful in various encoding/decoding protocols. The memory in the embedded system is limited and is shared by various application programs. If the length of the VLC decoder lookup table is fixed, the system efficiency will deteriorate accordingly. Since in various embedded system platforms, the memories are not designed for special purposes, the free memory size depends on different platforms and different program execution combination. Consequently, in designing the VLC decoder lookup table, the memory allocation issue is to be considered.
In the embedded system, the memory is shared by programs. Therefore when allocating the memory for the VLC decoder lookup table, what is considered is more than the efficiency of one single program. Let the VLC decoder be taken for example. Suppose there are two decoding algorithms A and B. The decoding algorithm A requires a memory space of 20 KB, and the decoding rate of the algorithm A is 2 lookups per symbol. The decoding algorithm B requires a memory space of 30 KB, and the decoding rate of the algorithm B is 1.8 lookups per symbol. If the system has 32 KB free memory space, then the decoding algorithm B is not the only choice, because the embedded system may execute other application programs which also require memory. Thus, how to make good use of limited memory resource is essential to the embedded system.
Moreover, according to the current algorithm for generating decoding lookup tables, the algorithm is fixed once selected. Under such circumstances, if the system efficiency or system resources are dynamically changed, it would not generate appropriate decoding lookup tables.